package com.fubowen.reader.db.model

import androidx.room.Ignore
import com.fubowen.reader.db.bean.BookChapterBean

data class BookChapter(
    var id: Int = 0,
    var name: String = "",
    var order: Int = 0,
    var content: String = "",
    var url: String? = null,
    var isDownload: Boolean = false,
    var isReading: Boolean = false,
    var position: Int = 0,
    var bookId: Int = 0,
    @Ignore
    var textSize: Float = 0f,
    @Ignore
    var lineSpacingMultiplier: Float = 0f,
    @Ignore
    var lineSpacingExtra: Float = 0f,
    @Ignore
    var backgroundColor: Int = -1,
    @Ignore
    var isLoading: Boolean = false,
    @Ignore
    var isPageStart: Boolean = false,
    @Ignore
    var headerTextSize: Float = 0f,
    @Ignore
    var headerLineSpacingMultiplier: Float = 0f,
    @Ignore
    var headerLineSpacingExtra: Float = 0f,
    @Ignore
    var textColor: Int = -1
) {
    constructor() : this(0)
}

fun List<BookChapterBean>.toBookChapter() = this.map {
    BookChapter(
        id = it.id,
        name = it.name,
        order = it.order,
        content = it.content,
        url = it.url,
        isDownload = it.isDownload,
        isReading = it.isReading,
        position = it.position,
        bookId = it.bookId,
    )
}